package com.lywz.biz.service.hotel.impl;

import java.util.Collection;
import java.util.Collections;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lywz.biz.common.dao.CommonDao;
import com.lywz.biz.common.entity.hotel.Hotel;
import com.lywz.biz.dao.hotel.HotelDao;
import com.lywz.biz.service.hotel.HotelService;
import com.lywz.core.log.LogClerk;

/**
 * 住宿Service实体类
 * 
 * @author Sunna
 * @date 2010-5-7 下午08:29:00
 */
@Service("hotelService")
public class HotelServiceImpl implements HotelService {

    @Autowired
    private HotelDao hotelDao;

    @Autowired
    private CommonDao commonDao;

    /*
     * (non-Javadoc)
     * @see com.lywz.biz.service.hotel.HotelService#queryHotelById(int)
     */
    @Override
    public Hotel queryHotelByHotelId(int hotelId) {
        try {
            return commonDao.queryById(Hotel.class, hotelId);
        } catch (Exception e) {
            LogClerk.sysout.error(e);
            return new Hotel();
        }
    }

    /*
     * (non-Javadoc)
     * @see com.lywz.biz.service.hotel.HotelService#queryHotelByCityId(int, int, int)
     */
    @Override
    public Collection<Hotel> queryHotelsByCityId(int cityId, int first, int max) {
        try {
            return hotelDao.queryHotelsByCityId(cityId, first, max);
        } catch (Exception e) {
            LogClerk.sysout.error(e);
            return Collections.emptyList();
        }
    }

    /*
     * (non-Javadoc)
     * @see com.lywz.biz.service.hotel.HotelService#queryHotelByScenicId(int, int, int)
     */
    @Override
    public Collection<Hotel> queryHotelsByScenicId(int scenicId, int first, int max) {
        try {
            return hotelDao.queryHotelsByScenicId(scenicId, first, max);
        } catch (Exception e) {
            LogClerk.sysout.error(e);
            return Collections.emptyList();
        }
    }

    /*
     * (non-Javadoc)
     * @see com.lywz.biz.service.hotel.HotelService#queryHotelByCompose(int, int, java.lang.String, int, int, int, int, int)
     */
    @Override
    public Collection<Hotel> queryHotelsByCompose(int cityId, int countryId, String name, int type,
            int bprize, int ePrize, int first, int max) {
        try {
            return hotelDao.queryHotelsByCompose(cityId, countryId, name, type, bprize, ePrize,
                    first, max);
        } catch (Exception e) {
            LogClerk.sysout.error(e);
            return Collections.emptyList();
        }
    }

}
